from django.shortcuts import render
from testdemo import models
from django.core.paginator import Paginator,Page

# Create your views here.
def sort1(request):
    ret = models.T_newsTables.objects.all().order_by('-post_date')
    # paginator = Paginator(ret, 10)
    # current_page = request.GET.get('page')
    # current_page = int(current_page)
    # posts = paginator.page(current_page)
    # return render(request, 'sort1.html', {'headline_list': posts,
    #                                       })
    return render(request, 'sort1.html', {'headline_list': ret,
                                          })


def sort2(request):
    ret = models.T_newsTables.objects.all().order_by('post_date')
    # paginator = Paginator(ret, 10)
    # current_page = request.GET.get('page')
    # current_page = int(current_page)
    # posts = paginator.page(current_page)
    # return render(request, 'sort1.html', {'headline_list': posts,
    #                                       })
    return render(request, 'sort1.html', {'headline_list': ret,
                                          })
